﻿<?xml version="1.0" encoding="utf-8" ?>

<scope
	xmlns="http://metalx.org/Program"
	xmlns:cpu16="http://metalx.org/Intel/80286/Operators"
	xmlns:op16="http://metalx.org/Intel/80286/Operands"
	xmlns:ex16="http://metalx.org/Intel/80286/ExtendedOperators"
	xmlns:gdt16="http://metalx.org/Intel/80286/DescriptorTable"
	xmlns:seg16="http://metalx.org/Intel/80286/Segments"
	xmlns:ctrl16="http://metalx.org/Intel/80286/Control"
	xmlns:imm16="http://metalx.org/Intel/80286/Immediate"
	xmlns:math16="http://metalx.org/Intel/80286/Math"
	xmlns:cr0="http://metalx.org/Intel/80386/Registers/ControlRegister0"
	xmlns:cpu32="http://metalx.org/Intel/80386/Operators"
	xmlns:op32="http://metalx.org/Intel/80386/Operands"
	xmlns:seg32="http://metalx.org/Intel/80386/Segments"
	xmlns:logic32="http://metalx.org/Intel/80386/Logic"
	xmlns:flp32="http://metalx.org/i386/Functions/FloppyDrive"
	xmlns:hex32="http://metalx.org/i386/Functions/Hexadecimal"
	xmlns:sys="http://metalx.org/Pc/Bios/System"
	xmlns:bios="http://metalx.org/Pc/Bios/Functions"
	xmlns:pic="http://metalx.org/Pc/Pic/Ports"
	xmlns:cmd="http://metalx.org/Pc/Pic/Commands">

	<!--Set CPU To Known State-->
	<cpu16:ClearDirectionFlag/>

	<cpu16:CopyImmediateToAX/>
	<hex>0000</hex>

	<cpu16:CopyOperandToSegmentRegister16/>
	<seg16:SS-AXRegister/>

	<cpu16:CopyImmediateToSP/>
	<hex>7c00</hex>

	<cpu16:CopyOperandToSegmentRegister16/>
	<seg16:DS-AXRegister/>

	<cpu16:CopyOperandToSegmentRegister16/>
	<seg16:ES-AXRegister/>

	<cpu16:CopyOperandToSegmentRegister16/>
	<seg16:FS-AXRegister/>

	<cpu16:CopyOperandToSegmentRegister16/>
	<seg16:GS-AXRegister/>

	<cpu16:CopyRegisterToOperand16/>
	<op16:AX-SPRegister/>

	<cpu16:JumpToImmediatePointer16/>
	<addressOf ref="start" type="Pointer16"/>

	<label id="start"/>

	<!--Enable A20 Gate-->
	<!--<cpu16:CopyImmediateToAX/>
	<sys:EnableA20Gate/>

	<cpu16:CallImmediate8Interrupt/>
	<bios:SystemFunctions/>-->

	<cpu16:ClearInterruptFlag/>


	<cpu16:CallRelative16/>
	<addressOf ref="waitForKeyboard" type="Relative16"/>

	<cpu16:CopyImmediateToAL/>
	<hex>AD</hex>

	<cpu16:WriteALToImmediate8Port/>
	<hex>64</hex>

	<cpu16:CallRelative16/>
	<addressOf ref="waitForKeyboard" type="Relative16"/>

	<cpu16:CopyImmediateToAL/>
	<hex>D0</hex>

	<cpu16:WriteALToImmediate8Port/>
	<hex>64</hex>

	<label id="waitForKeyboard2"/>

	<cpu16:ReadFromImmediate8PortToAL/>
	<hex>64</hex>

	<cpu16:TestALWithImmediate/>
	<binary>00000001</binary>

	<cpu16:BranchToRelativeIfZero8/>
	<addressOf ref="waitForKeyboard2" type="Relative8"/>

	<cpu16:ReadFromImmediate8PortToAL/>
	<hex>60</hex>

	<cpu16:PushAXToStack/>

	<cpu16:CallRelative16/>
	<addressOf ref="waitForKeyboard" type="Relative16"/>

	<cpu16:CopyImmediateToAL/>
	<hex>D1</hex>

	<cpu16:WriteALToImmediate8Port/>
	<hex>64</hex>

	<cpu16:CallRelative16/>
	<addressOf ref="waitForKeyboard" type="Relative16"/>

	<cpu16:PullAXFromStack/>

	<cpu16:OrALWithImmediate/>
	<binary>00000010</binary>

	<cpu16:WriteALToImmediate8Port/>
	<hex>60</hex>

	<cpu16:CallRelative16/>
	<addressOf ref="waitForKeyboard" type="Relative16"/>

	<cpu16:CopyImmediateToAL/>
	<hex>AE</hex>

	<cpu16:WriteALToImmediate8Port/>
	<hex>64</hex>

	<!--<cpu16:CallRelative16/>
	<addressOf ref="waitForKeyboard" type="Relative16"/>-->



	<cpu16:SetInterruptFlag/>

	<cpu16:CopyImmediateToAX/>
	<short>0</short>

	<cpu16:CopyOperandToSegmentRegister16/>
	<seg16:DS-AXRegister/>

	<cpu16:CopyOperandToSegmentRegister16/>
	<seg16:ES-AXRegister/>

	<!--Get Memory Map-->
	<!--<cpu16:Operand32/>
	<cpu16:CopyImmediateToDI/>
	<hex>00003000</hex>-->

	<!--<cpu16:Operand32/>
	<cpu16:CopyImmediateToBX/>
	<int>0</int>

	<label id="nextEntry"/>

	<cpu16:Operand32/>
	<cpu16:CopyImmediateToAX/>
	<hex>0000e820</hex>

	<cpu16:Operand32/>
	<cpu16:CopyImmediateToDX/>
	<string>PAMS</string>

	<cpu16:Operand32/>
	<cpu16:CopyImmediateToCX/>
	<int>24</int>

	<cpu16:CallImmediate8Interrupt/>
	<bios:SystemFunctions/>

	<cpu16:MathImmediate8ToOperand16Function/>
	<math16:AddToDIRegister/>
	<byte>24</byte>

	<cpu16:BranchToRelativeIfCarry8/>
	<addressOf ref="done" type="Relative8"/>

	<cpu16:MathImmediateToOperandFunction16/>
	<math16:CompareWithBXRegister/>
	<hex>0000</hex>

	<cpu16:BranchToRelativeIfEqual8/>
	<addressOf ref="done" type="Relative8"/>

	<cpu16:JumpToRelative8/>
	<addressOf ref="nextEntry" type="Relative8"/>

	<label id="done"/>-->

	<!--<cpu16:Operand32/>
	<cpu16:CopyImmediateToOperandFunction16/>
	<imm16:CopyImmediateToDIAddress/>
	<hex>ffffffff</hex>-->

	<!--Disable NMI-->
	<cpu16:ReadFromImmediate8PortToAL/>
	<hex>70</hex>

	<cpu16:OrALWithImmediate/>
	<binary>10000000</binary>

	<cpu16:WriteALToImmediate8Port/>
	<hex>70</hex>

	<!--Load Global Descriptor Table-->
	<cpu16:ClearInterruptFlag/>

	<cpu16:Operand32/>
	<cpu16:ExtendedOperator/>
	<ex16:DescriptorTableFunction/>
	<gdt16:CopyImmediate16AddressToGlobalDescriptorTableRegister/>
	<addressOf ref="globalDescriptorTablePointer" type="Absolute16"/>

	<!--Switch To 32-Bit Protected Mode-->
	<cpu16:ExtendedOperator/>
	<ex16:CopyControlRegisterToRegister/>
	<ctrl16:AX-ControlRegister0/>

	<cpu16:OrALWithImmediate/>
	<cr0:ProtectionEnabled/>

	<cpu16:OrALWithImmediate/>
	<cr0:NativeFpuErrorsEnabled/>

	<cpu16:OrALWithImmediate/>
	<cr0:MonitorCoprocessor/>

	<cpu16:AndALWithImmediate/>
	<binary>11111011</binary>

	<cpu16:ExtendedOperator/>
	<ex16:CopyRegisterToControlRegister/>
	<ctrl16:AX-ControlRegister0/>

	<!--Jump to segment-->
	<cpu16:JumpToImmediatePointer16/>
	<addressOf ref="enterProtectedMode" type="Absolute16"/>
	<hex>0008</hex>

	<!--32-bit Protected Mode-->
	<label id="enterProtectedMode"/>

	<!--Enable NMI-->
	<cpu32:ReadFromImmediate8PortToAL/>
	<hex>70</hex>

	<cpu32:AndALWithImmediate/>
	<binary>01111111</binary>

	<cpu32:WriteALToImmediate8Port/>
	<hex>70</hex>

	<!--Setup Segment Registers-->
	<cpu32:CopyImmediateToAX/>
	<hex>00000010</hex>

	<cpu32:CopyOperandToSegmentRegister/>
	<seg32:SS-AXRegister/>

	<cpu32:CopyImmediateToSP/>
	<hex>00010000</hex>

	<cpu32:CopyOperandToSegmentRegister/>
	<seg32:DS-AXRegister/>

	<cpu32:CopyOperandToSegmentRegister/>
	<seg32:ES-AXRegister/>

	<cpu32:CopyOperandToSegmentRegister/>
	<seg32:FS-AXRegister/>

	<cpu32:CopyOperandToSegmentRegister/>
	<seg32:GS-AXRegister/>

	<!--Reprogram Master Interrupt Controller-->
	<cpu32:CopyImmediateToAL/>
	<cmd:InitializeForEnvironment/>

	<cpu32:WriteALToImmediate8Port/>
	<pic:MasterCommand/>

	<cpu32:CopyImmediateToAL/>
	<byte>32</byte>

	<cpu32:WriteALToImmediate8Port/>
	<pic:MasterData/>

	<cpu32:CopyImmediateToAL/>
	<binary>00000100</binary>

	<cpu32:WriteALToImmediate8Port/>
	<pic:MasterData/>

	<cpu32:CopyImmediateToAL/>
	<cmd:Environment8086Mode/>

	<cpu32:WriteALToImmediate8Port/>
	<pic:MasterData/>

	<cpu32:CopyImmediateToAL/>
	<hex>00</hex>

	<cpu32:WriteALToImmediate8Port/>
	<pic:MasterData/>

	<!--Reprogram Slave Interrupt Controller-->
	<cpu32:CopyImmediateToAL/>
	<cmd:InitializeForEnvironment/>

	<cpu32:WriteALToImmediate8Port/>
	<pic:SlaveCommand/>

	<cpu32:CopyImmediateToAL/>
	<byte>40</byte>

	<cpu32:WriteALToImmediate8Port/>
	<pic:SlaveData/>

	<cpu32:CopyImmediateToAL/>
	<binary>00000010</binary>

	<cpu32:WriteALToImmediate8Port/>
	<pic:SlaveData/>

	<cpu32:CopyImmediateToAL/>
	<cmd:Environment8086Mode/>

	<cpu32:WriteALToImmediate8Port/>
	<pic:SlaveData/>

	<cpu32:CopyImmediateToAL/>
	<hex>00</hex>

	<cpu32:WriteALToImmediate8Port/>
	<pic:SlaveData/>

	<!--Read Disk Information From Floppy Drive-->
	<cpu32:CopyImmediateToDI/>
	<hex>00010000</hex>

	<cpu32:CopyImmediateToAX/>
	<int>1</int>

	<cpu32:CopyImmediateToCX/>
	<int>1</int>

	<cpu32:CallRelative/>
	<addressOf ref="readBlocks" type="Relative32"/>

	<cpu32:CopyOperandToRegister/>
	<op32:AX-DIAddressPlusImmediate8/>
	<byte>16</byte>

	<cpu32:CopyOperandToRegister/>
	<op32:CX-DIAddressPlusImmediate8/>
	<byte>20</byte>

	<cpu32:LogicFunction/>
	<logic32:PushDIAddressPlusImmediate8/>
	<byte>52</byte>

	<cpu32:CallRelative/>
	<addressOf ref="readBlocks" type="Relative32"/>

	<!--Read Programs From Floppy Drive-->
	<cpu32:CopyRegisterToOperand/>
	<op32:DI-SIRegister/>

	<cpu32:CopySIAddressToAXAndIncrementSI/>

	<cpu32:CopyRegisterToOperand/>
	<op32:AX-CXRegister/>

	<label id="forEachProgram"/>

	<cpu32:PushCXToStack/>

	<cpu32:CopySIAddressToAXAndIncrementSI/>

	<cpu32:PushAXToStack/>

	<cpu32:CopySIAddressToAXAndIncrementSI/>

	<cpu32:CopyRegisterToOperand/>
	<op32:AX-CXRegister/>

	<cpu32:CopySIAddressToAXAndIncrementSI/>

	<cpu32:CopyRegisterToOperand/>
	<op32:AX-DIRegister/>

	<cpu32:PullAXFromStack/>

	<cpu32:CallRelative/>
	<addressOf ref="readBlocks" type="Relative32"/>

	<cpu32:PullCXFromStack/>

	<cpu32:LoopToRelative8/>
	<addressOf ref="forEachProgram" type="Relative8"/>

	<!--Restore Start Address-->
	<cpu16:PullSIFromStack/>

	<!--Jump To 32-Bit Boot Loader-->
	<cpu32:JumpToImmediatePointer/>
	<hex>00008000</hex>
	<hex>0008</hex>


	<!--Functions-->
	<label id="readBlocks"/>

	<cpu32:PushSIToStack/>
	<cpu32:PushDIToStack/>

	<!--<flp32:ReadBlocks/>-->
	
			<scope
				xmlns:var="http://metalx.org/Variable"
				xmlns:ns="http://metalx.org/i386/Functions/FloppyDrive"
				xmlns:ari="http://metalx.org/Intel/80386/Arithmetic"
				xmlns:inc="http://metalx.org/Intel/80386/Increment"
				xmlns:imm="http://metalx.org/Intel/80386/Immediate"
				xmlns:math="http://metalx.org/Intel/80386/Math"
				xmlns:shift="http://metalx.org/Intel/80386/Shift"
				xmlns:obj="http://metalx.org/i386/Functions/Object"
				xmlns:lst="http://metalx.org/i386/Functions/List"
				xmlns:cat="http://metalx.org/i386/Functions/Catalog"
				xmlns:sys="http://metalx.org/i386/Functions/System"
				xmlns:mm="http://metalx.org/i386/Functions/MemoryManager"
				xmlns:flp="http://metalx.org/Pc/Floppy/Ports"
				xmlns:fcmd="http://metalx.org/Pc/Floppy/Commands"
				xmlns:fdr="http://metalx.org/Pc/Floppy/DataRate"
				xmlns:fdo="http://metalx.org/Pc/Floppy/DigitalOutput"
				xmlns:fst="http://metalx.org/Pc/Floppy/Status"
				xmlns:cpu="http://metalx.org/Intel/80386/Operators"
				xmlns:op="http://metalx.org/Intel/80386/Operands"
				xmlns:cmos="http://metalx.org/Pc/Cmos/Ports"
				xmlns:cmr="http://metalx.org/Pc/Cmos/Registers">
			<!--<cpu:PushAXToStack/>-->

			<!--Disable DMA Channel 2-->
			<!--<cpu:CopyImmediateToAL/>
			<byte>2</byte>

			<cpu:OrALWithImmediate/>
			<binary>00000100</binary>

			<cpu:WriteALToImmediate8Port/>
			<hex>0a</hex>-->

			<!--Set DMA Target Address-->
			<!--<cpu:CopyImmediateToAL/>
			<hex>ff</hex>

			<cpu:WriteALToImmediate8Port/>
			<hex>0c</hex>

			<cpu:CopyImmediateToAL/>
			<hex>00</hex>

			<cpu:WriteALToImmediate8Port/>
			<hex>04</hex>

			<cpu:CopyImmediateToAL/>
			<hex>70</hex>

			<cpu:WriteALToImmediate8Port/>
			<hex>04</hex>

			<cpu:CopyImmediateToAL/>
			<hex>00</hex>

			<cpu:WriteALToImmediate8Port/>
			<hex>81</hex>-->

			<!--Set DMA Length (minus 1)-->
			<!--<cpu:CopyImmediateToAL/>
			<hex>ff</hex>

			<cpu:WriteALToImmediate8Port/>
			<hex>0c</hex>

			<cpu:CopyImmediateToAL/>
			<hex>ff</hex>

			<cpu:WriteALToImmediate8Port/>
			<hex>05</hex>

			<cpu:CopyImmediateToAL/>
			<hex>01</hex>

			<cpu:WriteALToImmediate8Port/>
			<hex>05</hex>-->

			<!--Set DMA Mode-->
			<!--<cpu:CopyImmediateToAL/>
			<binary>01000110</binary>-->

			<!--<cpu:CopyImmediateToAL/>
			<binary>01010110</binary>-->

			<!--<cpu:WriteALToImmediate8Port/>
			<hex>0b</hex>-->

			<!--Enable DMA Channel 2-->
			<!--<cpu:CopyImmediateToAL/>
			<byte>2</byte>

			<cpu:WriteALToImmediate8Port/>
			<hex>0a</hex>-->

			<!--Reset Controller-->
			<cpu:PushAXToStack/>

			<cpu:CopyImmediateToDX/>
			<flp:Controller0/>
			<hex>0000</hex>

			<cpu:MathImmediate8ToOperandFunction/>
			<math:AddToDXRegister/>
			<flp:DigitalOutput/>

			<cpu:CopyImmediateToAL/>
			<fdo:Drive0MotorEnabled/>

			<cpu:OrALWithImmediate/>
			<fdo:SelectDrive0/>

			<cpu:OrALWithImmediate/>
			<fdo:IrqAndDmaEnabled/>

			<!--<cpu:WriteALToDXPort/>-->

			<cpu:OrALWithImmediate/>
			<fdo:Enabled/>

			<cpu:WriteALToDXPort/>

			<!--Wait For Controller Reset-->
			<cpu:CopyImmediateToDX/>
			<flp:Controller0/>
			<hex>0000</hex>

			<cpu:MathImmediate8ToOperandFunction/>
			<math:AddToDXRegister/>
			<flp:MainStatus/>

			<label id="waitForReset"/>

			<cpu:ReadFromDXPortToAL/>

			<cpu:TestALWithImmediate/>
			<fst:WaitingForData/>

			<cpu:BranchToRelative8IfZero/>
			<addressOf ref="waitForReset" type="Relative8"/>

			<cpu:PullAXFromStack/>

			<!--Load Data-->
			<label id="forEachBlock"/>

			<cpu:PushAXToStack/>

			<!--Disable DMA Channel 2-->
			<cpu:CopyImmediateToAL/>
			<byte>2</byte>

			<cpu:OrALWithImmediate/>
			<binary>00000100</binary>

			<cpu:WriteALToImmediate8Port/>
			<hex>0a</hex>

			<!--Set DMA Target Address-->
			<cpu:CopyImmediateToAL/>
			<hex>ff</hex>

			<cpu:WriteALToImmediate8Port/>
			<hex>0c</hex>

			<cpu:CopyImmediateToAL/>
			<hex>00</hex>

			<cpu:WriteALToImmediate8Port/>
			<hex>04</hex>

			<cpu:CopyImmediateToAL/>
			<hex>70</hex>

			<cpu:WriteALToImmediate8Port/>
			<hex>04</hex>

			<cpu:CopyImmediateToAL/>
			<hex>00</hex>

			<cpu:WriteALToImmediate8Port/>
			<hex>81</hex>

			<!--Set DMA Length (minus 1)-->
			<cpu:CopyImmediateToAL/>
			<hex>ff</hex>

			<cpu:WriteALToImmediate8Port/>
			<hex>0c</hex>

			<!--<cpu:CopyImmediateToAL/>
			<hex>00</hex>-->

			<cpu:CopyImmediateToAL/>
			<hex>ff</hex>

			<cpu:WriteALToImmediate8Port/>
			<hex>05</hex>

			<!--<cpu:CopyImmediateToAL/>
			<hex>02</hex>-->

			<cpu:CopyImmediateToAL/>
			<hex>01</hex>

			<cpu:WriteALToImmediate8Port/>
			<hex>05</hex>

			<!--Set DMA Mode-->
			<cpu:CopyImmediateToAL/>
			<binary>01000110</binary>

			<!--<cpu:CopyImmediateToAL/>
			<binary>01010110</binary>-->

			<cpu:WriteALToImmediate8Port/>
			<hex>0b</hex>

			<!--Enable DMA Channel 2-->
			<cpu:CopyImmediateToAL/>
			<byte>2</byte>

			<cpu:WriteALToImmediate8Port/>
			<hex>0a</hex>

			<!--Reset Controller-->
			<!--<cpu:CopyImmediateToDX/>
		<flp:Controller0/>
		<hex>0000</hex>

		<cpu:MathImmediate8ToOperandFunction/>
		<math:AddToDXRegister/>
		<flp:DigitalOutput/>

		<cpu:CopyImmediateToAL/>
		<fdo:Drive0MotorEnabled/>

		<cpu:OrALWithImmediate/>
		<fdo:SelectDrive0/>

		<cpu:OrALWithImmediate/>
		<fdo:IrqAndDmaEnabled/>

		<cpu:WriteALToDXPort/>

		<cpu:OrALWithImmediate/>
		<fdo:Enabled/>

		<cpu:WriteALToDXPort/>-->

			<!--Wait For Controller Reset-->
			<!--<cpu:CopyImmediateToDX/>
		<flp:Controller0/>
		<hex>0000</hex>

		<cpu:MathImmediate8ToOperandFunction/>
		<math:AddToDXRegister/>
		<flp:MainStatus/>

		<label id="waitForReset"/>

		<cpu:ReadFromDXPortToAL/>

		<cpu:TestALWithImmediate/>
		<fst:WaitingForData/>

		<cpu:BranchToRelative8IfZero/>
		<addressOf ref="waitForReset" type="Relative8"/>-->

			<!--Calculate Sector-->
			<cpu:PullAXFromStack/>
			<cpu:PushAXToStack/>

			<cpu:CopyImmediateToDX/>
			<int>0</int>

			<cpu:CopyImmediateToBX/>
			<int>18</int>

			<cpu:ArithmeticDXAXOperandFunction/>
			<ari:DivideByBXRegister/>

			<cpu:IncrementDX/>

			<cpu:PushDXToStack/>
			<cpu:PushDXToStack/>

			<!--Calculate Head and Track-->
			<cpu:CopyImmediateToDX/>
			<int>0</int>

			<cpu:CopyImmediateToBX/>
			<int>2</int>

			<cpu:ArithmeticDXAXOperandFunction/>
			<ari:DivideByBXRegister/>

			<cpu:PushDXToStack/>
			<cpu:PushAXToStack/>
			<cpu:PushDXToStack/>

			<!--Send Read Command-->
			<cpu:CopyImmediateToDX/>
			<flp:Controller0/>
			<hex>0000</hex>

			<cpu:MathImmediate8ToOperandFunction/>
			<math:AddToDXRegister/>
			<flp:Data/>

			<cpu:CopyImmediateToAL/>
			<fcmd:ReadData/>

			<cpu:OrALWithImmediate/>
			<fcmd:MagneticFormatMode/>

			<cpu:WriteALToDXPort/>

			<!--Drive / Head Number-->
			<cpu:PullAXFromStack/>

			<cpu:ShiftRegisterByImmediate8Function/>
			<shift:ShiftAXRegisterLeft/>
			<byte>2</byte>

			<cpu:WriteALToDXPort/>

			<!--Cylinder Number-->
			<cpu:PullAXFromStack/>

			<cpu:WriteALToDXPort/>

			<!--Head Number-->
			<cpu:PullAXFromStack/>

			<cpu:WriteALToDXPort/>

			<!--Sector Number-->
			<cpu:PullAXFromStack/>

			<cpu:WriteALToDXPort/>

			<!--Sector Type-->
			<cpu:CopyImmediateToAL/>
			<byte>2</byte>

			<cpu:WriteALToDXPort/>

			<!--Last Sector Number-->
			<cpu:PullAXFromStack/>

			<!--<cpu:CopyImmediateToAX/>
			<int>1</int>-->

			<!--<cpu:CopyImmediateToAX/>
			<int>18</int>-->

			<!--<cpu:IncrementAX/>-->

			<cpu:WriteALToDXPort/>

			<!--Gap Length-->
			<cpu:CopyImmediateToAL/>
			<byte>27</byte>

			<cpu:WriteALToDXPort/>

			<!--Bytes Per Sector (not used)-->
			<cpu:CopyImmediateToAL/>
			<hex>ff</hex>

			<cpu:WriteALToDXPort/>

			<cpu:CopyImmediateToAX/>
			<int>0</int>

			<!--Wait For Data-->
			<cpu:CopyImmediateToDX/>
			<flp:Controller0/>
			<hex>0000</hex>

			<cpu:MathImmediate8ToOperandFunction/>
			<math:AddToDXRegister/>
			<flp:MainStatus/>

			<label id="waitForData"/>

			<cpu:ReadFromDXPortToAL/>

			<!--<cpu:TestALWithImmediate/>
			<fst:DataAvailable/>-->

			<cpu:TestALWithImmediate/>
			<fst:WaitingForData/>

			<cpu:BranchToRelative8IfZero/>
			<addressOf ref="waitForData" type="Relative8"/>

			<!--Read Output-->
			<!--<cpu:CopyImmediateToDX/>
		<flp:Controller0/>
		<hex>0000</hex>

		<cpu:MathImmediate8ToOperandFunction/>
		<math:AddToDXRegister/>
		<flp:Data/>-->

			<!--Status 0-->
			<!--<cpu:ReadFromDXPortToAL/>-->

			<!--Status 1-->
			<!--<cpu:ReadFromDXPortToAL/>-->

			<!--Status 2-->
			<!--<cpu:ReadFromDXPortToAL/>-->

			<!--Cylinder-->
			<!--<cpu:ReadFromDXPortToAL/>-->

			<!--Last Head Number-->
			<!--<cpu:ReadFromDXPortToAL/>-->

			<!--Last Sector Number-->
			<!--<cpu:ReadFromDXPortToAL/>-->

			<!--Last Sector Type-->
			<!--<cpu:ReadFromDXPortToAL/>-->

			<!--Read Results-->
			<label id="waitForResults"/>

			<cpu:CopyImmediateToDX/>
			<flp:Controller0/>
			<hex>0000</hex>

			<cpu:MathImmediate8ToOperandFunction/>
			<math:AddToDXRegister/>
			<flp:MainStatus/>

			<cpu:ReadFromDXPortToAL/>

			<cpu:TestALWithImmediate/>
			<fst:CommandReceived/>

			<cpu:BranchToRelative8IfZero/>
			<addressOf ref="copyData" type="Relative8"/>

			<cpu:CopyImmediateToDX/>
			<flp:Controller0/>
			<hex>0000</hex>

			<cpu:MathImmediate8ToOperandFunction/>
			<math:AddToDXRegister/>
			<flp:Data/>

			<cpu:ReadFromDXPortToAL/>

			<cpu:JumpToRelative8/>
			<addressOf ref="waitForResults" type="Relative8"/>

			<!--Copy Data To Address-->
			<label id="copyData"/>

			<cpu:PushCXToStack/>

			<cpu:CopyImmediateToSI/>
			<hex>00007000</hex>

			<cpu:CopyImmediateToCX/>
			<int>128</int>

			<cpu:Repeat/>
			<cpu:CopySIAddressToDIAddressAndIncrementSIAndDI/>

			<cpu:PullCXFromStack/>
			<cpu:PullAXFromStack/>

			<cpu:IncrementAX/>
			<cpu:DecrementCX/>

			<cpu:BranchToRelative8IfZero/>
			<addressOf ref="turnOffMotor" type="Relative8"/>

			<cpu:JumpToRelative/>
			<addressOf ref="forEachBlock" type="Relative32"/>

			<!--Turn Off Motor-->
			<label id="turnOffMotor"/>

			<cpu:CopyImmediateToDX/>
			<flp:Controller0/>
			<hex>0000</hex>

			<cpu:MathImmediate8ToOperandFunction/>
			<math:AddToDXRegister/>
			<flp:DigitalOutput/>

			<!--<cpu:CopyImmediateToAL/>
			<fdo:Enabled/>

			<cpu:OrALWithImmediate/>
			<fdo:SelectDrive0/>-->

			<cpu:CopyImmediateToAL/>
			<fdo:SelectDrive0/>

			<cpu:WriteALToDXPort/>
		</scope>


	<cpu32:PullDIFromStack/>
	<cpu32:PullSIFromStack/>

	<cpu32:ReturnToNearCaller/>

	<label id="waitForKeyboard"/>
	
	<cpu16:ReadFromImmediate8PortToAL/>
	<hex>64</hex>

	<cpu16:TestALWithImmediate/>
	<binary>00000010</binary>

	<cpu16:BranchToRelativeIfNotZero8/>
	<addressOf ref="waitForKeyboard" type="Relative8"/>

	<cpu16:ReturnToNearCaller/>

	<!--Global Descriptor Table-->
	<label id="globalDescriptorTable"/>


	<!--Null Descriptor (0000)-->

	<!--Size-->
	<hex>0000</hex>
	<!--Base (Low)-->
	<hex>0000</hex>
	<!--Base (Mid)-->
	<hex>00</hex>
	<!--Access-->
	<binary>00000000</binary>
	<!--Flags / Size (High)-->
	<binary>00000000</binary>
	<!--Base (High)-->
	<hex>00</hex>


	<!--Code Descriptor (0008)-->

	<!--Size-->
	<hex>ffff</hex>
	<!--Base (Low)-->
	<hex>0000</hex>
	<!--Base (Mid)-->
	<hex>00</hex>
	<!--Access-->
	<binary>10011010</binary>
	<!--Flags / Size (High)-->
	<binary>11001111</binary>
	<!--Base (High)-->
	<hex>00</hex>


	<!--Data Descriptor (0010)-->

	<!--Size-->
	<hex>ffff</hex>
	<!--Base (Low)-->
	<hex>0000</hex>
	<!--Base (Mid)-->
	<hex>00</hex>
	<!--Access-->
	<binary>10010010</binary>
	<!--Flags / Size (High)-->
	<binary>11001111</binary>
	<!--Base (High)-->
	<hex>00</hex>


	<!--Global Descriptor Table Pointer-->
	<label id="globalDescriptorTablePointer"/>
	<short>23</short>
	<addressOf ref="globalDescriptorTable" type="Absolute16"/>

</scope>